﻿@using BonjourQuotation.UI.Models.PartialModel
@using MvcCheckBoxList
@model OperationGroupCheckListGridViewModel
@{
    Layout = null;
    
}
<script type="text/javascript">
    var GroupCheckListModel;
    var SelectedGroupCheckListGridData = [];
    debugger;
    LoadGroupCheckListGrid(false);
    function LoadGroupCheckListGrid(IsGroupCheckListClientLoad) {
        if (!IsGroupCheckListClientLoad)
            GroupCheckListModel = $(@Html.Raw(Json.Encode(Model))).JSModel();
        var GroupCheckListcolumnHeaders = [];
        var GroupCheckListcolumns = [];
        var GroupCheckListcolWidth = [];
        var GroupCheckListcolOrder = [];
        var ArrCitydrop = [];
        var GroupCheckListStatusDrop = [];


        if (GroupCheckListModel[0].OperationGroupCheckListGroupCodeView) {
            if (GroupCheckListModel[0].ViewGroupCheckListGroupCode == true) {
                GroupCheckListcolumnHeaders.push($("#GroupCheckListGroupCodeDiv").html());
                GroupCheckListModel[0].OperationGroupCheckListGroupCodeEdit ? GroupCheckListcolumns.push({ data: "GroupCheckListGroupCode", type: "text" }) : GroupCheckListcolumns.push({ data: "GroupCheckListGroupCode", type: "text", readOnly: true  });
                GroupCheckListcolWidth.push(140);
                GroupCheckListcolOrder.push(GroupCheckListModel[0].OperationGroupCheckListGroupCodeLineNo);
                $("#GroupCheckListGridGroupCheckListGroupCodeDiv").hide();
            }
            else
                $("#GroupCheckListGridGroupCheckListGroupCodeDiv").show();
        }

        if (GroupCheckListModel[0].OperationGroupCheckListGroupNameView) {
            if (GroupCheckListModel[0].ViewGroupCheckListGroupName == true) {
                GroupCheckListcolumnHeaders.push($("#GroupCheckListGroupNameDiv").html());
                GroupCheckListModel[0].OperationGroupCheckListGroupNameEdit ? GroupCheckListcolumns.push({ data: "GroupCheckListGroupName", type: "text" }) : GroupCheckListcolumns.push({ data: "GroupCheckListGroupName", type: "text", readOnly: true });
                GroupCheckListcolWidth.push(220);
                GroupCheckListcolOrder.push(GroupCheckListModel[0].OperationGroupCheckListGroupNameLineNo);
                $("#GroupCheckListGridAGroupCheckListGroupNameDiv").hide();
            }
            else
                $("#GroupCheckListGridGroupCheckListGroupNameDiv").show();
        }

        if (GroupCheckListModel[0].OperationGroupCheckListCustomerView) {
            if (GroupCheckListModel[0].ViewGroupCheckListCustomer == true) {
                GroupCheckListcolumnHeaders.push($("#GroupCheckListCustomerDiv").html());
                GroupCheckListModel[0].OperationGroupCheckListCustomerEdit ? GroupCheckListcolumns.push({ data: "GroupCheckListCustomer", type: "text" }) : GroupCheckListcolumns.push({ data: "GroupCheckListCustomer", type: "text", readOnly: true });
                GroupCheckListcolWidth.push(200);
                GroupCheckListcolOrder.push(GroupCheckListModel[0].OperationGroupCheckListCustomerLineNo);
                $("#GroupCheckListGridAGroupCheckListCustomerDiv").hide();
            }
            else
                $("#GroupCheckListGridGroupCheckListCustomerDiv").show();
        }
        if (GroupCheckListModel[0].OperationGroupCheckListMonthOfArrivalView) {
            if (GroupCheckListModel[0].ViewGroupCheckListMonthOfArrival == true) {
                GroupCheckListcolumnHeaders.push($("#GroupCheckListMonthOfArrivalDiv").html());
                GroupCheckListModel[0].OperationGroupCheckListMonthOfArrivalEdit ? GroupCheckListcolumns.push({ data: "GroupCheckListMonthOfArrival", type: "text" }) : GroupCheckListcolumns.push({ data: "GroupCheckListMonthOfArrival", type: "text", readOnly: true });
                GroupCheckListcolWidth.push(160);
                GroupCheckListcolOrder.push(GroupCheckListModel[0].OperationGroupCheckListMonthOfArrivalLineNo);
                $("#GroupCheckListGridGroupCheckListMonthOfArrivalDiv").hide();
            }
            else
                $("#GroupCheckListGridGroupCheckListMonthOfArrivalDiv").show();
        }

        if (GroupCheckListModel[0].OperationGroupCheckListArrivalDateView) {
            if (GroupCheckListModel[0].ViewGroupCheckListArrivalDate == true) {
                GroupCheckListcolumnHeaders.push($("#GroupCheckListArrivalDateDiv").html());
                GroupCheckListModel[0].OperationGroupCheckListArrivalDateEdit ? GroupCheckListcolumns.push({ data: "GroupCheckListArrivalDate", type: "date", dateFormat: 'D, dd/M/yy' }) : GroupCheckListcolumns.push({ data: "GroupCheckListArrivalDate", type: "date", dateFormat: 'D, dd/M/yy', readOnly: true });
                GroupCheckListcolWidth.push(140);
                GroupCheckListcolOrder.push(GroupCheckListModel[0].OperationGroupCheckListArrivalDateLineNo);
                $("#GroupCheckListGridGroupCheckListArrivalDateDiv").hide();
            }
            else
                $("#GroupCheckListGridGroupCheckListArrivalDateDiv").show();
        }
        if (GroupCheckListModel[0].OperationGroupCheckListDepartureDateView) {
            if (GroupCheckListModel[0].ViewGroupCheckListDepartureDate == true) {
                GroupCheckListcolumnHeaders.push($("#GroupCheckListDepartureDateDiv").html());
                GroupCheckListModel[0].OperationGroupCheckListDepartureDateEdit ? GroupCheckListcolumns.push({ data: "GroupCheckListDepartureDate", type: "date", dateFormat: 'D, dd/M/yy' }) : GroupCheckListcolumns.push({ data: "GroupCheckListDepartureDate", type: "date", dateFormat: 'D, dd/M/yy', readOnly: true });
                GroupCheckListcolWidth.push(140);
                GroupCheckListcolOrder.push(GroupCheckListModel[0].OperationGroupCheckListDepartureDateLineNo);
                $("#GroupCheckListGridGroupCheckListDepartureDateDiv").hide();
            }
            else
                $("#GroupCheckListGridGroupCheckListDepartureDateDiv").show();
        }

        if (GroupCheckListModel[0].OperationGroupCheckListArrivalCityView) {
            if (GroupCheckListModel[0].ViewGroupCheckListArrivalCity == true) {
                GroupCheckListcolumnHeaders.push($("#GroupCheckListArrivalCityDiv").html());
                GroupCheckListModel[0].OperationGroupCheckListArrivalCityEdit ? GroupCheckListcolumns.push({ data: "GroupCheckListArrivalCity", type: "dropdown", source: ArrCitydrop }) : GroupCheckListcolumns.push({ data: "GroupCheckListArrivalCity", type: "dropdown", source: ArrCitydrop, readOnly: true });
                GroupCheckListcolWidth.push(140);
                GroupCheckListcolOrder.push(GroupCheckListModel[0].OperationGroupCheckListArrivalCityLineNo);
                $("#GroupCheckListGroupCheckListArrivalCityDiv").hide();
            }
            else
                $("#GroupCheckListGroupCheckListArrivalCityDiv").show();
        }

        if (GroupCheckListModel[0].OperationGroupCheckListDepartureCityView) {
            if (GroupCheckListModel[0].ViewGroupCheckListDepartureCity == true) {
                GroupCheckListcolumnHeaders.push($("#GroupCheckListDepartureCityDiv").html());
                GroupCheckListModel[0].OperationGroupCheckListDepartureCityEdit ? GroupCheckListcolumns.push({ data: "GroupCheckListDepartureCity", type: "dropdown", source: ArrCitydrop }) : GroupCheckListcolumns.push({ data: "GroupCheckListDepartureCity", type: "dropdown", source: ArrCitydrop, readOnly: true });
                GroupCheckListcolWidth.push(140);
                GroupCheckListcolOrder.push(GroupCheckListModel[0].OperationGroupCheckListDepartureCityLineNo);
                $("#GroupCheckListGroupCheckListDepartureCityDiv").hide();
            }
            else
                $("#GroupCheckListGroupCheckListDepartureCityDiv").show();
        }

        if (GroupCheckListModel[0].OperationGroupCheckListPaxView) {
            if (GroupCheckListModel[0].ViewGroupCheckListPax == true) {
                GroupCheckListcolumnHeaders.push($("#GroupCheckListPaxDiv").html());
                GroupCheckListModel[0].OperationGroupCheckListPaxEdit ? GroupCheckListcolumns.push({ data: "GroupCheckListPax", type: "numeric" }) : GroupCheckListcolumns.push({ data: "GroupCheckListPax", type: "numeric", readOnly: true });
                GroupCheckListcolWidth.push(60);
                GroupCheckListcolOrder.push(GroupCheckListModel[0].OperationGroupCheckListPaxLineNo);
                $("#GroupCheckListGridGroupCheckListPaxDiv").hide();
            }
            else
                $("#GroupCheckListGridGroupCheckListPaxDiv").show();
        }
        if (GroupCheckListModel[0].OperationGroupCheckListIsGirView) {
            if (GroupCheckListModel[0].ViewGroupCheckListIsGir == true) {
                GroupCheckListcolumnHeaders.push($("#GroupCheckListIsGirDiv").html());
                GroupCheckListModel[0].OperationGroupCheckListIsGirEdit ? GroupCheckListcolumns.push({ data: "GroupCheckListIsGir", type: "text" }) : GroupCheckListcolumns.push({ data: "GroupCheckListIsGir", type: "text", readOnly: true });
                GroupCheckListcolWidth.push(60);
                GroupCheckListcolOrder.push(GroupCheckListModel[0].OperationGroupCheckListIsGirLineNo);
                $("#GroupCheckListGridGroupCheckListIsGirDiv").hide();
            }
            else
                $("#GroupCheckListGridGroupCheckListIsGirDiv").show();
        }
        if (GroupCheckListModel[0].OperationGroupCheckListIsGirView) {
            if (GroupCheckListModel[0].ViewGroupCheckListHotelStatus == true) {
                GroupCheckListcolumnHeaders.push($("#GroupCheckListHotelStatusDiv").html());
                GroupCheckListModel[0].OperationGroupCheckListIsGirEdit ? GroupCheckListcolumns.push({ data: "GroupCheckListHotelStatus", type: "text" }) : GroupCheckListcolumns.push({ data: "GroupCheckListHotelStatus", type: "text", readOnly: true });
                GroupCheckListcolWidth.push(100);
                GroupCheckListcolOrder.push(GroupCheckListModel[0].OperationGroupCheckListIsGirLineNo);
                $("#GroupCheckListGridGroupCheckListHotelStatusDiv").hide();
            }
            else
                $("#GroupCheckListGridGroupCheckListHotelStatusDiv").show();
        }
        if (GroupCheckListModel[0].OperationGroupCheckListHotelNotesView) {
            if (GroupCheckListModel[0].ViewGroupCheckListHotelNotes == true) {
                GroupCheckListcolumnHeaders.push($("#GroupCheckListHotelNotesDiv").html());
                GroupCheckListModel[0].OperationGroupCheckListHotelNotesEdit ? GroupCheckListcolumns.push({ data: "GroupCheckListHotelNotes", type: "text" }) : GroupCheckListcolumns.push({ data: "GroupCheckListHotelNotes", type: "text", readOnly: true });
                GroupCheckListcolWidth.push(450);
                GroupCheckListcolOrder.push(GroupCheckListModel[0].OperationGroupCheckListHotelNotesLineNo);
                $("#GroupCheckListGridGroupCheckListHotelNotesDiv").hide();
            }
            else
                $("#GroupCheckListGridGroupCheckListHotelNotesDiv").show();
        }
        if (GroupCheckListModel[0].OperationGroupCheckListBusGuideNotesView) {
            if (GroupCheckListModel[0].ViewGroupCheckListBusGuideNotes == true) {
                GroupCheckListcolumnHeaders.push($("#GroupCheckListBusGuideNotesDiv").html());
                GroupCheckListModel[0].OperationGroupCheckListBusGuideNotesEdit ? GroupCheckListcolumns.push({ data: "GroupCheckListBusGuideNotes", type: "text" }) : GroupCheckListcolumns.push({ data: "GroupCheckListBusGuideNotes", type: "text", readOnly: true });
                GroupCheckListcolWidth.push(450);
                GroupCheckListcolOrder.push(GroupCheckListModel[0].OperationGroupCheckListBusGuideNotesLineNo);
                $("#GroupCheckListGridGroupCheckListBusGuideNotesDiv").hide();
            }
            else
                $("#GroupCheckListGridGroupCheckListBusGuideNotesDiv").show();
        }

        for (var ind1 = 0; ind1 < GroupCheckListcolOrder.length; ind1++)
            for (var ind2 = ind1 + 1; ind2 < GroupCheckListcolOrder.length; ind2++) {
                if (GroupCheckListcolOrder[ind2] < GroupCheckListcolOrder[ind1]) {
                    var ord = GroupCheckListcolOrder[ind2];
                    GroupCheckListcolOrder[ind2] = GroupCheckListcolOrder[ind1];
                    GroupCheckListcolOrder[ind1] = ord;
                    var Header = GroupCheckListcolumnHeaders[ind2];
                    GroupCheckListcolumnHeaders[ind2] = GroupCheckListcolumnHeaders[ind1];
                    GroupCheckListcolumnHeaders[ind1] = Header;
                    var Width = GroupCheckListcolWidth[ind2];
                    GroupCheckListcolWidth[ind2] = GroupCheckListcolWidth[ind1];
                    GroupCheckListcolWidth[ind1] = Width;
                    var Col = GroupCheckListcolumns[ind2];
                    GroupCheckListcolumns[ind2] = GroupCheckListcolumns[ind1];
                    GroupCheckListcolumns[ind1] = Col;
                }
            }
        GrpCheckListRedColorRendererForNegative = function (instance, td, row, col, prop, value, cellProperties) {
            Handsontable.renderers.NumericRenderer.apply(this, arguments);
            td.style.color = 'red';
        };
        var GroupCheckListdata = GroupCheckListModel[0].Rows;

        $('#OperGroupCheckListGrid').handsontable({
            data: GroupCheckListdata,
            minSpareRows: 1,
            colHeaders: GroupCheckListcolumnHeaders,
            colWidths: GroupCheckListcolWidth,
            customBorders: true,
            contextMenu: false,
            manualColumnResize: true,
            manualRowResize: true,
            manualColumnMove: true,
            wordWrap: false,
            columns: GroupCheckListcolumns,
            afterSelectionEnd: function (row1, column1, row2, column2) {
                SelectedGroupCheckListGridData.length = 0;
                SelectedGroupCheckListGridData.push(row1);
                SelectedGroupCheckListGridData.push(row2);
                SelectedGroupCheckListGridData.push(column1);
                SelectedGroupCheckListGridData.push(column2);
                $("#GroupCheckListGetSelected").removeAttr('disabled');
            },
            afterChange: function (data, source) {

            },
            cells: function (row, col) {
                var Cellinstance = this;
                if (Cellinstance.renderer == Handsontable.renderers.NumericRenderer && Cellinstance.instance.getDataAtCell(row, col) < 0) {
                    Cellinstance.renderer = GrpCheckListRedColorRendererForNegative;
                }
            }
        });
        if ($("#IsRemoveGroupCheckListFilterDivShow").val() == "True") {
            $("#GroupCheckListRemoveFiltersDiv").show();
        }
    }
    function GroupCheckListGetSelectedClick() {
        if ($("#GroupCheckListForEmail").length > 0) {
            $("#GroupCheckListForEmail").remove();
        }
        //get the instance using jQuery wrapper
        var SelectedGroupCheckListGridDataHeaders = [];
        var SelectedGroupCheckListElementValues = [];
        if (SelectedGroupCheckListGridData[2] > SelectedGroupCheckListGridData[3]) {
            var a = SelectedGroupCheckListGridData[3];
            SelectedGroupCheckListGridData[3] = SelectedGroupCheckListGridData[2];
            SelectedGroupCheckListGridData[2] = a;

        }
        if (SelectedGroupCheckListGridData[0] > SelectedGroupCheckListGridData[1]) {
            var a = SelectedGroupCheckListGridData[0];
            SelectedGroupCheckListGridData[0] = SelectedGroupCheckListGridData[1];
            SelectedGroupCheckListGridData[1] = a;

        }
        for (var ind = SelectedGroupCheckListGridData[2]; ind <= SelectedGroupCheckListGridData[3]; ++ind) {
            SelectedGroupCheckListGridDataHeaders.push(($('#OperGroupCheckListGrid').handsontable('getColHeader', ind)));
        }
        var hadstontabledata = $('#OperGroupCheckListGrid').handsontable('getData', SelectedGroupCheckListGridData[0], SelectedGroupCheckListGridData[2], SelectedGroupCheckListGridData[1], SelectedGroupCheckListGridData[3]);
        $("#OperGroupCheckListGridForm").append("<div id='GroupCheckListForEmail' style='Display:None'></div>");

        var table = $('<table></table>');

        var Headercolumn = $("<tr style='border: 1px solid black;border-collapse: collapse'></tr>");
        for (i = 0; i < SelectedGroupCheckListGridDataHeaders.length; i++) {
            var Headerrow = $("<td style='border: 1px solid black;border-collapse: collapse;background-color:red;color:white'></td>").html(SelectedGroupCheckListGridDataHeaders[i]);
            Headercolumn.append(Headerrow);
            table.append(Headercolumn);
        }
        $(table).find('.GroupCheckListGridFilterBtn').each(function () {
            $(this).remove();
        });
        $(table).find('.GroupCheckListGridViewBtn').each(function () {
            $(this).remove();
        });
        $(table).find('input').each(function () {
            $(this).remove();
        });
        for (i = 0; i < hadstontabledata.length; i++) {
            var columntr = $("<tr style='border: 1px solid black;border-collapse: collapse'></tr>");
            for (j = 0; j < hadstontabledata[i].length; ++j) {
                var rowtd = $("<td style='border: 1px solid black;border-collapse: collapse'></td>").html(hadstontabledata[i][j]);
                columntr.append(rowtd)
            }
            table.append(columntr);
        }

        $('#GroupCheckListForEmail').append(table);
    }
    //GroupCheckList Grid column Hide Unhide
    function GroupCheckListGridColumnHideUnhide(element) {
        debugger
        var column = $(element).attr('id');
        switch (column) {
            case "GroupCheckListGridGroupCheckListGroupNameView":
                {
                    if (GroupCheckListModel[0].ViewGroupCheckListGroupName == true)
                        GroupCheckListModel[0].ViewGroupCheckListGroupName = false;
                    else
                        GroupCheckListModel[0].ViewGroupCheckListGroupName = true;
                }
                break;
            case "GroupCheckListGridGroupCheckListGroupCodeView":
                {
                    if (GroupCheckListModel[0].ViewGroupCheckListGroupCode == true)
                        GroupCheckListModel[0].ViewGroupCheckListGroupCode = false;
                    else
                        GroupCheckListModel[0].ViewGroupCheckListGroupCode = true;
                }
                break;
            case "GroupCheckListGridGroupCheckListCustomerView":
                {
                    if (GroupCheckListModel[0].ViewGroupCheckListCustomer == true)
                        GroupCheckListModel[0].ViewGroupCheckListCustomer = false;
                    else
                        GroupCheckListModel[0].ViewGroupCheckListCustomer = true;
                }
                break;
            case "GroupCheckListGridGroupCheckListPaxView":
                {
                    if (GroupCheckListModel[0].ViewGroupCheckListPax == true)
                        GroupCheckListModel[0].ViewGroupCheckListPax = false;
                    else
                        GroupCheckListModel[0].ViewGroupCheckListPax = true;
                }
                break;
            case "GroupCheckListGridGroupCheckListIsGirView":
                {
                    if (GroupCheckListModel[0].ViewGroupCheckListIsGir == true)
                        GroupCheckListModel[0].ViewGroupCheckListIsGir = false;
                    else
                        GroupCheckListModel[0].ViewGroupCheckListIsGir = true;
                }
                break;
            case "GroupCheckListGridGroupCheckListHotelStatusView":
                {
                    if (GroupCheckListModel[0].ViewGroupCheckListHotelStatus == true)
                        GroupCheckListModel[0].ViewGroupCheckListHotelStatus = false;
                    else
                        GroupCheckListModel[0].ViewGroupCheckListHotelStatus = true;
                }
                break;
            case "GroupCheckListGridGroupCheckListHotelNotesView":
                {
                    if (GroupCheckListModel[0].ViewGroupCheckListHotelNotes == true)
                        GroupCheckListModel[0].ViewGroupCheckListHotelNotes = false;
                    else
                        GroupCheckListModel[0].ViewGroupCheckListHotelNotes = true;
                }
                break;
            case "GroupCheckListGridGroupCheckListBusGuideNotesView":
                {
                    if (GroupCheckListModel[0].ViewGroupCheckListBusGuideNotes == true)
                        GroupCheckListModel[0].ViewGroupCheckListBusGuideNotes = false;
                    else
                        GroupCheckListModel[0].ViewGroupCheckListBusGuideNotes = true;
                }
                break;
            case "GroupCheckListGridGroupCheckListMonthOfArrivalView":
                {
                    if (GroupCheckListModel[0].ViewGroupCheckListMonthOfArrival == true)
                        GroupCheckListModel[0].ViewGroupCheckListMonthOfArrival = false;
                    else
                        GroupCheckListModel[0].ViewGroupCheckListMonthOfArrival = true;
                }
                break;
            case "GroupCheckListGridGroupCheckListArrivalDateView":
                {
                    if (GroupCheckListModel[0].ViewGroupCheckListArrivalDate == true)
                        GroupCheckListModel[0].ViewGroupCheckListArrivalDate = false;
                    else
                        GroupCheckListModel[0].ViewGroupCheckListArrivalDate = true;
                }
                break;
            case "GroupCheckListGridGroupCheckListDepartureDateView":
                {
                    if (GroupCheckListModel[0].ViewGroupCheckListDepartureDate == true)
                        GroupCheckListModel[0].ViewGroupCheckListDepartureDate = false;
                    else
                        GroupCheckListModel[0].ViewGroupCheckListDepartureDate = true;
                }
                break;
            case "GroupCheckListGridGroupCheckListArrivalCityView":
                {
                    if (GroupCheckListModel[0].ViewGroupCheckListArrivalCity == true)
                        GroupCheckListModel[0].ViewGroupCheckListArrivalCity = false;
                    else
                        GroupCheckListModel[0].ViewGroupCheckListArrivalCity = true;
                }
                break;
            case "GroupCheckListGridGroupCheckListDepartureDateView":
                {
                    if (GroupCheckListModel[0].ViewGroupCheckListDepartureCity == true)
                        GroupCheckListModel[0].ViewGroupCheckListDepartureCity = false;
                    else
                        GroupCheckListModel[0].ViewGroupCheckListDepartureCity = true;
                }
                break;
            default:
                break;
        }
        LoadGroupCheckListGrid(true);
    }
    // toggle Search params
    function GroupCheckListSearchToggle() {
        if ($("#SearchGroupCheckListToggleDiv").hasClass("SearchHotelToggleDivMore")) {
            $("#SearchGroupCheckListToggleDiv").removeClass("SearchHotelToggleDivMore");
            $("#SearchGroupCheckListToggleDiv").addClass("SearchHotelToggleDivLess");
        }
        else {
            $("#SearchGroupCheckListToggleDiv").addClass("SearchHotelToggleDivMore");
            $("#SearchGroupCheckListToggleDiv").removeClass("SearchHotelToggleDivLess");
        }
        $("#OperSearchGroupCheckList").toggle(200);
    };
    $(document).on("copy", "#GroupCheckListGetSelected", function (e) {
        debugger
        GroupCheckListGetSelectedClick();
        var table = $("#GroupCheckListForEmail");
        e.clipboardData.clearData();
        e.clipboardData.setData("text/html", table.html());
        e.preventDefault();
        $("#GroupCheckListForEmail").remove();
        $("#GroupCheckListGetSelected").attr('disabled', true);

    });
    function RemoveGroupCheckListFilter(element) {
        debugger
        var columnFilter = $(element).attr('id');
        switch (columnFilter) {
            case "GroupCheckListRemoveCustomerFilter":
                {
                    $("#IsRemoveGroupCheckListCustomerCodeFilter").val("True");
                }
                break;
            case "GroupCheckListRemoveGroupCodeFilter":
                {
                    $("#IsRemoveGroupCheckListGroupCodeFilter").val("True");
                }
                break;
            case "GroupCheckListRemoveGroupNameFilter":
                {
                    $("#IsRemoveGroupCheckListGroupNameFilter").val("True");
                }
                break;
            default:
                break;
        }
        $("#IsGroupCheckListFilter").val("True");
        isGroupCheckListFilter = "True";
        $("#GroupCheckListGridUpdate").click();
    }
</script>
<div class="OperationTabsTitleDiv">
    <span class="OperationTabsTitle">Group CheckList</span>
</div>
@using (Ajax.BeginForm("SaveOperationGroupCheckListGridData", "Operation", new AjaxOptions() { HttpMethod = "Post", UpdateTargetId = "tabGroupCheckList", OnComplete = "GroupCheckListGridAjaxComplated", InsertionMode = InsertionMode.Replace }, new { enctype = "multipart/form-data", id = "OperGroupCheckListGridForm" }))
{
    <div id="SearchGroupCheckListToggleDiv" class="SearchHotelToggleDivMore" onclick="GroupCheckListSearchToggle()"></div>
    <div id="OperSearchGroupCheckList" style="display: none; height: 55px; width:1185px; background-color: rgba(128, 128, 128, 0.8); ">
        <div class="pull-right" style="margin-left:25px; margin-bottom:15px;">
            <div class="row form-row">
                <div class=" col-lg-3">
                    <div class="input-group">
                        <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.GroupCheckListSearchGroupCode)</span>
                        @Html.TextBoxFor(model => model.GroupCheckListSearchGroupCode, new { @class = "TxtComplete form-control table_inputs_SmallPadding2 inpputgr" })
                    </div>
                </div>
                <div class=" col-lg-3">
                    <div class="input-group">
                        <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.GroupCheckListSearchGroupName)</span>
                        @Html.TextBoxFor(model => model.GroupCheckListSearchGroupName, new { @class = "TxtComplete form-control table_inputs_SmallPadding2 inpputgr" })
                    </div>
                </div>
                <div class=" col-lg-3">
                    <div class="input-group">
                        <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.GroupCheckListSearchCustomer)</span>
                        @Html.TextBoxFor(model => model.GroupCheckListSearchCustomer, new { @class = "TxtComplete form-control table_inputs_SmallPadding2 inpputgr" })
                    </div>
                </div>
                <div class=" col-lg-2" style="width:13% !important;">
                    <div class="input-group">
                        <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.IsGir)</span>
                        @Html.DropDownListFor(x => x.GroupCheckListSearchSelectedIsGir, new SelectList(Model.IsGir, "Value", "Text"), "Select", new { @class = "form-control table_inputs_SmallPadding2 inpputgr" })
                    </div>
                </div>
                <div class="pull-right col-lg-1">
                    <div class="pull-right input-group">
                        <input type="button" id="GroupCheckListGroupSearchBtn" onclick="GroupCheckListGroupSearchBtnClick()" class="btn14 pull-right" value="Search" style="margin-right:17px;">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="GroupCheckListGridGroupCheckListGroupCodeDiv" style="@(@Model.ViewGroupCheckListGroupCode ? "display:none" : "")">
        <div class="GroupCheckListGridViewBtnDiv">
            <span>Group Code</span>
            <div id="GroupCheckListGridGroupCheckListGroupCodeView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="GroupCheckListGridGroupCheckListGroupNameDiv" style="@(@Model.ViewGroupCheckListGroupName ? "display:none" : "")">
        <div class="GroupCheckListGridViewBtnDiv">
            <span>Group Name</span>
            <div id="GroupCheckListGridGroupCheckListGroupNameView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="GroupCheckListGridGroupCheckListCustomerDiv" style="@(@Model.ViewGroupCheckListCustomer ? "display:none" : "")">
        <div class="GroupCheckListGridViewBtnDiv">
            <span>Customer</span>
            <div id="GroupCheckListGridGroupCheckListCustomerView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="GroupCheckListGridGroupCheckListPaxDiv" style="@(@Model.ViewGroupCheckListPax ? "display:none" : "")">
        <div class="GroupCheckListGridViewBtnDiv">
            <span>Pax</span><div id="GroupCheckListGridGroupCheckListPaxView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
        </div>
    </div>
      <div id="GroupCheckListGridGroupCheckListIsGirDiv" style="@(@Model.ViewGroupCheckListIsGir ? "display:none" : "")">
        <div class="GroupCheckListGridViewBtnDiv">
            <span>Is Gir</span><div id="GroupCheckListGridGroupCheckListIsGirView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="GroupCheckListGridGroupCheckListHotelStatusDiv" style="@(@Model.ViewGroupCheckListHotelStatus ? "display:none" : "")">
        <div class="GroupCheckListGridViewBtnDiv">
            <span>Hotel Status</span><div id="GroupCheckListGridGroupCheckListHotelStatusView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="GroupCheckListGridGroupCheckListHotelNotesDiv" style="@(@Model.ViewGroupCheckListHotelNotes ? "display:none" : "")">
        <div class="GroupCheckListGridViewBtnDiv">
            <span>Hotel Notes</span><div id="GroupCheckListGridGroupCheckListHotelNotesView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="GroupCheckListGridGroupCheckListBusGuideNotesDiv" style="@(@Model.ViewGroupCheckListBusGuideNotes ? "display:none" : "")">
        <div class="GroupCheckListGridViewBtnDiv">
            <span>Bus-Guide Notes</span><div id="GroupCheckListGridGroupCheckListBusGuideNotesView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="GroupCheckListGridGroupCheckListMonthOfArrivalDiv" style="@(@Model.ViewGroupCheckListMonthOfArrival ? "display:none" : "")">
        <div class="GroupCheckListGridViewBtnDiv">
            <span>Month Of Arrival</span><div id="GroupCheckListGridGroupCheckListMonthOfArrivalView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="GroupCheckListGridGroupCheckListArrivalDateDiv" style="@(@Model.ViewGroupCheckListArrivalDate ? "display:none" : "")">
        <div class="GroupCheckListGridViewBtnDiv">
            <span>Arrival Date</span><div id="GroupCheckListGridGroupCheckListArrivalDateView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="GroupCheckListGridGroupCheckListArrivalCityDiv" style="@(@Model.ViewGroupCheckListArrivalCity ? "display:none" : "")">
        <div class="GroupCheckListGridViewBtnDiv">
            <span>Arrival City</span><div id="GroupCheckListGridGroupCheckListArrivalCityView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="GroupCheckListGridGroupCheckListDepartureDateDiv" style="@(@Model.ViewGroupCheckListDepartureDate ? "display:none" : "")">
        <div class="GroupCheckListGridViewBtnDiv">
            <span>Departure Date</span><div id="GroupCheckListGridGroupCheckListDepartureDateView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="GroupCheckListGridGroupCheckListDepartureCityDiv" style="@(@Model.ViewGroupCheckListArrivalCity ? "display:none" : "")">
        <div class="GroupCheckListGridViewBtnDiv">
            <span>Departure City</span><div id="GroupCheckListGridGroupCheckListDepartureCityView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="GroupCheckListRemoveFiltersDiv" class="GroupCheckListRemoveFiltersDiv" style="display:none">
        <span class="GroupCheckListRemoveFiltersSpan">Filters :</span>
        @if (Model.GroupCheckListFilterSelGroupCode != null)
        {
            if (Model.GroupCheckListFilterSelGroupCode.Count > 0)
            {
                <div class="GroupCheckListGridViewBtnDiv"><span>Group Code</span><div id="GroupCheckListRemoveGroupCodeFilter" class="GroupCheckListGridViewBtn" onclick="RemoveGroupCheckListFilter(this)"></div></div>
                Model.IsRemoveGroupCheckListFilterDivShow = true;
            }
        }
        @if (Model.GroupCheckListFilterSelGroupName != null)
        {
            if (Model.GroupCheckListFilterSelGroupName.Count > 0)
            {
                <div class="GroupCheckListGridViewBtnDiv"><span>Group Name</span><div id="GroupCheckListRemoveGroupNameFilter" class="GroupCheckListGridViewBtn" onclick="RemoveGroupCheckListFilter(this)"></div></div>
                Model.IsRemoveGroupCheckListFilterDivShow = true;
            }
        }
        @if (Model.GroupCheckListFilterSelCustomerCode != null)
        {
            if (Model.GroupCheckListFilterSelCustomerCode.Count > 0)
            {
                <div class="GroupCheckListGridViewBtnDiv"><span>Customer</span><div id="GroupCheckListRemoveCustomerFilter" class="GroupCheckListGridViewBtn" onclick="RemoveGroupCheckListFilter(this)"></div></div>
                Model.IsRemoveGroupCheckListFilterDivShow = true;
            }
        }
    </div>
    <div id="OperGroupCheckListGridFilters" style="width:1200px; float:left; padding-top:12px; padding-right:5px; padding-bottom:8px;">
        <div id="GroupCheckListGridGroupCodeMainDiv" class="GroupCheckListGridFilterDiv">
            <div class="GroupCheckListGridFilterDivClose"></div>
            @Html.CheckBoxListFor(model => model.SelectedGroupCheckListFilterGroupCode,
                                   model => model.GroupCheckListFilterGroupCode,
                                      grp => grp.Id,
                                      grp => grp.Name,
                                      model => model.GroupCheckListFilterSelGroupCode,
                                      MvcCheckBoxList.Model.Position.Vertical)
        </div>
        <div id="GroupCheckListGridGroupNameMainDiv" class="GroupCheckListGridFilterDiv">
            <div class="GroupCheckListGridFilterDivClose"></div>
            @Html.CheckBoxListFor(model => model.SelectedGroupCheckListFilterGroupName,
                                      model => model.GroupCheckListFilterGroupName,
                                      grp => grp.Id,
                                      grp => grp.Name,
                                      model => model.GroupCheckListFilterSelGroupName,
                                      MvcCheckBoxList.Model.Position.Vertical)
        </div>
        <div id="GroupCheckListGridCustomerCodeMainDiv" class="GroupCheckListGridFilterDiv">
            <div class="GroupCheckListGridFilterDivClose"></div>
            @Html.CheckBoxListFor(model => model.SelectedGroupCheckListFilterCustomerCode,
                                      model => model.GroupCheckListFilterCustomerCode,
                                      grp => grp.Id,
                                      grp => grp.Name,
                                      model => model.GroupCheckListFilterSelCustomerCode,
                                      MvcCheckBoxList.Model.Position.Vertical)
        </div>
    </div>
        <div style="display:none;">
            <div id="GroupCheckListGroupCodeDiv">
                <div class="OperationHotelGroupInfo">
                    <span>Group Code</span>
                    @Html.HiddenFor(model => model.ViewGroupCheckListGroupCode)
                    <div id="GroupCheckListGridGroupCheckListGroupCodeView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
                    @if (@Model.OperationGroupCheckListGroupCodeFilter)
                    {
                        <div class="GroupCheckListGridFilterBtn" id="GroupCheckListGridGroupCode"></div>
                    }
                </div>
            </div>
            <div id="GroupCheckListGroupNameDiv">
                <div class="OperationHotelGroupInfo">
                    <span>Group Name</span>
                    @Html.HiddenFor(model => model.ViewGroupCheckListGroupName)
                    <div id="GroupCheckListGridGroupCheckListGroupNameView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
                    @if (@Model.OperationGroupCheckListGroupNameFilter)
                    {
                        <div class="GroupCheckListGridFilterBtn" id="GroupCheckListGridGroupName"></div>
                    }
                </div>
            </div>
            <div id="GroupCheckListCustomerDiv">
                <div class="OperationHotelGroupInfo">
                    <span>Customer</span>
                    @Html.HiddenFor(model => model.ViewGroupCheckListCustomer)
                    <div id="GroupCheckListGridGroupCheckListCustomerView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
                    @if (@Model.OperationGroupCheckListCustomerFilter)
                    {
                        <div class="GroupCheckListGridFilterBtn" id="GroupCheckListGridCustomerCode"></div>
                    }
                </div>
            </div>
            <div id="GroupCheckListMonthOfArrivalDiv">
                <div class="OperationHotelGroupInfo">
                    <span>Month Of Arrival</span>
                    @Html.HiddenFor(model => model.ViewGroupCheckListMonthOfArrival)
                    <div id="GroupCheckListGridGroupCheckListMonthOfArrivalView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
                </div>
            </div>
            <div id="GroupCheckListArrivalDateDiv">
                <div class="OperationHotelGroupInfo">
                    <span>Arrival Date</span>
                    @Html.HiddenFor(model => model.ViewGroupCheckListArrivalDate)
                    <div id="GroupCheckListGridGroupCheckListArrivalDateView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
                </div>
            </div>
            <div id="GroupCheckListArrivalCityDiv">
                <div class="OperationHotelGroupInfo">
                    <span>Arrival City</span>
                    @Html.HiddenFor(model => model.ViewGroupCheckListArrivalCity)
                    <div id="GroupCheckListGridGroupCheckListArrivalCityView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
                </div>
            </div>
            <div id="GroupCheckListDepartureDateDiv">
                <div class="OperationHotelGroupInfo">
                    <span>Departure Date</span>
                    @Html.HiddenFor(model => model.ViewGroupCheckListDepartureDate)
                    <div id="GroupCheckListGridGroupCheckListDepartureDateView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
                </div>
            </div>
            <div id="GroupCheckListDepartureCityDiv">
                <div class="OperationHotelGroupInfo">
                    <span>Departure City</span>
                    @Html.HiddenFor(model => model.ViewGroupCheckListDepartureCity)
                    <div id="GroupCheckListGridGroupCheckListDepartureCityView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
                </div>
            </div>
            <div id="GroupCheckListPaxDiv">
                <div class="OperationHotelGroupInfo">
                    <span>Pax</span>
                    @Html.HiddenFor(model => model.ViewGroupCheckListPax)
                    <div id="GroupCheckListGridGroupCheckListPaxView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
                </div>
            </div>
            <div id="GroupCheckListIsGirDiv">
                <div class="OperationHotelGroupInfo">
                    <span>Is Gir</span>
                    @Html.HiddenFor(model => model.ViewGroupCheckListIsGir)
                    <div id="GroupCheckListGridGroupCheckListIsGirView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
                </div>
            </div>
            <div id="GroupCheckListHotelStatusDiv">
                <div class="OperationHotelGroupInfo">
                    <span>Hotel Status</span>
                    @Html.HiddenFor(model => model.ViewGroupCheckListHotelStatus)
                    <div id="GroupCheckListGridGroupCheckListHotelStatusView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
                </div>
            </div>
            <div id="GroupCheckListHotelNotesDiv">
                <div class="OperationHotelGroupInfo">
                    <span>Hotel Notes</span>
                    @Html.HiddenFor(model => model.ViewGroupCheckListHotelNotes)
                    <div id="GroupCheckListGridGroupCheckListHotelNotesView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
                </div>
            </div>
            <div id="GroupCheckListBusGuideNotesDiv">
                <div class="OperationHotelGroupInfo">
                    <span>Bus-Guide Notes</span>
                    @Html.HiddenFor(model => model.ViewGroupCheckListBusGuideNotes)
                    <div id="GroupCheckListGridGroupCheckListBusGuideNotesView" class="GroupCheckListGridViewBtn" onclick="GroupCheckListGridColumnHideUnhide(this)"></div>
                </div>
            </div>
        </div>
     <div id="OperGroupCheckListGrid" class="handsontable" style="width: 1185px; height:420px; overflow:auto;"></div>
    @Html.HiddenFor(model => model.GroupCheckListPageNumber)
    @Html.HiddenFor(model => model.IsGroupCheckListFilter)
    @Html.HiddenFor(model => model.IsGroupCheckListSearch)
    @Html.HiddenFor(model => model.IsGroupCheckListView)
    @Html.HiddenFor(model => model.IsGroupCheckListCanView)
    @Html.HiddenFor(model => model.GroupCheckListLeftScrollPossition)
    @Html.HiddenFor(model => model.GroupCheckListTopScrollPossition)
    
    @Html.HiddenFor(model => model.IsRemoveGroupCheckListFilterDivShow)
    @Html.HiddenFor(model => model.IsRemoveGroupCheckListCustomerCodeFilter)
    @Html.HiddenFor(model => model.IsRemoveGroupCheckListGroupCodeFilter)
    @Html.HiddenFor(model => model.IsRemoveGroupCheckListGroupNameFilter)
     <div style="width:330px;height:25px;text-align:center;margin-top:15px;float:right">
        <div style="margin:0">
            <input type="button" id="GroupCheckListMoreBtn" onclick="GroupCheckListMoreBtnClick()" class="btn14 pull-right" value="More" style="@(@Model.IsGroupCheckListCanView ? "" : "display:none");margin-left:10px;">
            <input type="button" id="GroupCheckListGetSelected" class="btn14 btn120 pull-right" value="Copy For Email" disabled="disabled">
        </div>
    </div>
    <button id="GroupCheckListGridUpdate" style="display:none;" type="submit"></button>
}





